feat: add Discord channel#79
Open
srflmr wants to merge 1 commit into
Open
Conversation
Implement Discord as a first-class channel alongside Telegram and WhatsApp, replacing the prior UI-only scaffolding. - backend/channels/discord.py: DiscordChannel(BaseChannel) using discord.py. Runs an async client on a daemon thread (mirrors the Telegram channel). Listens to DMs and to guild messages that @mention the bot; routes through the agent runtime and replies in the originating channel. - Reuses the shared pairing/allowlist flow, outbound buffering, typing indicator, and approval prompts (rendered as discord.ui buttons). - Media: image vision (data URL), file send, and attachment persistence, gated by the agent's attachment config and per-type size limits. - Register 'discord' in the channel registry; add discord.py>=2.3. - doctor: add a channel-integrations check (verifies the library is present for configured channels; notes the required Message Content Intent). - UI: add a setup hint under the Discord bot-token field. - README: mark Discord as implemented. - Tests: unit_tests/test_discord_channel.py covers helpers, message gating, start() guards, and the pairing/approval flow. Note: Discord requires the privileged Message Content Intent to be enabled in the Developer Portal for the bot to read message text.
4c2be5f to
f182f9d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add Discord as a messaging channel, alongside the existing Telegram and WhatsApp channels.
Change
DiscordChannel(BaseChannel)inbackend/channels/discord.py— an async client on a daemon thread, mirroring the Telegram channel's structure. Listens to DMs and to guild messages that @mention the bot, routes them through the agent runtime, and replies in the originating channel. Reuses the shared pairing/allowlist flow, outbound buffering, typing indicator, and approval prompts (rendered asdiscord.uibuttons). Media: image vision, file send, attachment persistence — gated by the agent's attachment config and per-type size limits.'discord'inCHANNEL_TYPES(the channel registry is the only extension point).requirements.txt:discord.py>=2.3.doctorgains a channel-integrations check (verifies the library is present for configured channels; notes the required Message Content Intent).templates/agent_detail.html.Notes
Why it's safe
models/schema changes.Test plan
test_discord_channelgreen (Discord client mocked).doctor --quickchannel-integrations check runs cleanly.